//
//  File.swift
//  
//
//  Created by AE86 on 2021/7/28.
//

import Foundation
import UIKit
import SwiftUI

public struct TableViewAppearance {
    
    
    public static func setupAppearance() {
        //TODO: Move that to SwiftUI once implemented
        let descriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .title1).withSymbolicTraits(.traitBold)?.withDesign(UIFontDescriptor.SystemDesign.rounded)
        let descriptor2 = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .largeTitle).withSymbolicTraits(.traitBold)?.withDesign(UIFontDescriptor.SystemDesign.rounded)
        
        UINavigationBar.appearance().largeTitleTextAttributes = [
            NSAttributedString.Key.font:UIFont.init(descriptor: descriptor2!, size: 34),
            NSAttributedString.Key.foregroundColor: UIColor(.acText)
        ]
        
        UINavigationBar.appearance().titleTextAttributes = [
            NSAttributedString.Key.font:UIFont.init(descriptor: descriptor!, size: 17),
            NSAttributedString.Key.foregroundColor: UIColor(.acText)
        ]
        
        UINavigationBar.appearance().barTintColor = UIColor(.acSecondaryBackground)
        UINavigationBar.appearance().isTranslucent = true
        UINavigationBar.appearance().tintColor = UIColor(.acText)
        
        UITableView.appearance().backgroundColor = UIColor(.acBackground)
        UITableView.appearance().tableFooterView = UIView()
    }
    
}
